﻿using System;
using Sharp.Domain.PlatformBoundedContext.UserModule.Aggregates;
using Sharp.Domain.PlatformBoundedContext.UserModule.Events;
using Sharp.Domain.PlatformBoundedContext.UserModule.Services;
using Sharp.Events;
using Sharp.Infrastructure.IoC;

namespace Sharp.Domain.PlatformBoundedContext.PermissionModule.Events
{
    [Async]
    public class PermissionEventHandler : IEventHandler<PermissionChangedEventData>
    {
        public PermissionEventHandler()
        {
        }
        public void Handle(PermissionChangedEventData e)
        {
            var userService = ServiceLocator.Instance.GetService<IUserService>();

            userService.RefurbishUserPermissionData(e.UserId);
        }
    }
}